import React, { Component } from 'react';

import './index.scss';

export default class TableBody extends Component {

	render() {

		const { posterBookData, onStatusClick } = this.props;

		return (
			<tbody>
				{
					posterBookData && posterBookData.map((item, index) => {
						return (
							<tr key={index}>

								<td className="id-td">{item.id}</td>

								<td className="img-td">
									<img
										className="poster-book-img"
										src={`http://gcimg.mvvm.xyz/${item.imgKey}`}
										alt='' />
								</td>
								
								<td className="btn-td">
									<button
										className={['btn', item.status ? 'btn-danger' : 'btn-success'].join(' ')}
										onClick={() => onStatusClick(item.id, index)}
									>
										{item.status ? '下线' : '上线'}
									</button>
								</td>
							</tr>
						);
					})
				}
			</tbody>
		);
	}
}